home *** CD-ROM | disk | FTP | other *** search
- Path: cs.vu.nl!sun4nl!xs4all!marketgraph!rvg
- From: rvg@marketgraph.xs4all.nl (Ruud van Gaal)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Need help with strings in SAS/C
- Keywords: Keywords: SAS C
- Message-ID: <0212nbs60.alamito@marketgraph.xs4all.nl>
- Date: Wed, 14 Feb 96 13:18:02 CET
- References: <4fehq5$keg@news.unicomp.net>
- Reply-To: rvg@marketgraph.xs4all.nl
- X-Newsreader: Alamito Mail and News Manager (V2.0.4 for Waffle) registered to MARKETGRAPH VISUAL AUTOMATION
-
- In <4fehq5$keg@news.unicomp.net> rays@conline.com (Ray Schmalzl) wrote:
-
- > Could somebody out there help me with strings in SAS/C? I have a few
- >books on C in general, but none of them cover this quite enough. I have two
- >problems. The first is getting the function atoi to work right. For example:
- >
- >#include <stdio.h>
- >#include <stdlib.h>
- >void main()
- >{
- > char CharOne, CharTwo[]="012345";
- >
- > CharOne = getch(); // assume typing in a digit here
- >
- > printf("%c\t",CharOne) ;
- > printf("%i\n",atoi(CharOne)) ;
- >
- > printf("%c\t",CharTwo[3]) ;
- > printf("%i\n",atoi (CharTwo[3]) ;
-
- Should be atoi(&CharTwo[3]) (the address of byte 3 of CharTwo, note that
- atoi(CharTwo) is seen as atoi(&CharTwo[0]). atoi(CharOne) does not do what
- you expect. It's not the Basic's ASC(CharOne) or CHR(CharOne), but atoi takes
- a string (CharOne now is a char, a string is a pointer to an array of chars),
- not a char.
-
- >}
- >
- >
-
- >The SECOND question I have is: If I have a variable in my program like:
- > char MF[]="ABCDEFG";
- >how can I set up a watch in the Code Probe debugger that will display the
- >array as CHARACTERS, and not as hex values??
-
- Don't know.
-
- --
- Ruud van Gaal
- MarketGraph Visual Automation
- E-Mail : rvg@marketgraph.xs4all.nl
- DoomShell 4.5 homepage: http://www.xs4all.nl/~jwkorver
- "...Works fascinates me. I could sit and watch it for hours..."
-
-